<!DOCTYPE html>
<html>
  <head>
    <title>EmulatorJS Manager</title>
    <link rel="stylesheet" href="public/css/index.css">
  </head>
  <body>
    <div id="top" class="top">
      <div id="nav" class="nav">
        <div onclick="renderRoms()" class="top-item">Rom Management</div>
        <div onclick="renderConfigss()" class="top-item">Config Management</div>
        <div onclick="renderFiles()" class="top-item">File Management</div>
        <div onclick="renderProfile()" class="top-item">Profile Management</div>
        <div onclick="renderMeta()" class="top-item">Custom Metadata</div>
      </div>
      <div id="nav-buttons" class="nav-buttons"></div>
    </div>
    <div class="page-container">
      <div id="side"></div>
      <div id="main"></div>
    </div>
    <div id="modal">
      <div id="modal-content"></div>
      <div id="close" onclick="closeModal()"></div>
    </div>
    <div id="rominfo" class="hidden">
      <div class="readme">
        <h2>Support</h2>
	<p>For general support please use our <a href="https://discord.gg/YWrKVTn">Discord Server</a>, if you would like to report a bug or have a feature request please do that on <a href="https://github.com/linuxserver/emulatorjs/issues">GitHub</a>.</p>
        <p>If you are upgrading from previous versions and not seeing a performance increase please do a hard reload on your browser and delete the retroarch.cfg file from the file browser icon (top left of frontent interface folder icon).</p>
        <p>If you are upgrading from previous versions the n64 core has been switched to a libretro core you will need to change the config file to have '"emulator": "libretro-mupen64plus_next"' under the defaults section of the n64 config to use the new core.</p>
        <h2>Basic controls</h2>
        <p>For all libretro based emulators you can use F1 on your keyboard, start+select+L+R on a gamepad , or the touch button on the top left in touchscreen devices to bring up the in game menu.</p>
        <p>All saves and any settings are stored in your actual web browser by the URL you are using to access this container, to ensure sram is dumped on exit always try to exit the game with back instead of closing the browser window. On libretro based emulators you can perform saves and savestates from the menu.</p>
        <p>Xbox users on Edge hold the start button for 3 seconds to exit gamepad controls and if you want to re-enter again press the start button again with your cursor hovering over the game and select the option to use gamepad controls. After you launch a game press the select button a couple times to ensure the B button does not trigger a back action or drop you from fullscreen.</p>
	<p>Scrolling large collections can be sped up by holding right while scrolling up or down when using a keyboard or your controller on Xbox. For touch devices panning is supported by holding and dragging up or down.</p>
        <p>You can also scroll by letter using the right and left shoulder buttons on a controller or Page Up/Page Down on a keyboard.</p>
	<h2>Browser support</h2>
	<p>Only Safari for Apple devices and Chromium based browsers are supported. Other browsers might work, but have not been tested and likely never will be. Gamepads do not function on Firefox, this is a known issue as they do very non standard mapping like dpad button presses to a fake anaolgue joypad.</p>
        <h2>If you enjoy this</h2>
	<p>Consider <a href="https://retroarch.com/index.php?page=donate">supporting</a> libretro they do the heavy lifting. Also take a look at helping with art assets <a href="https://github.com/linuxserver/emulatorjs">Here</a>.</p>
        <h2>Experimental Emulators</h2>
        <p>More emulators are included than listed below please see <a href="https://github.com/linuxserver/libretrojs">HERE</a> for a complete list of libretro cores. To use an alternative/experimental core just add "libretro-" to the beginning of it's name for the emulator setting for your system config.</p>
	<h3>Full speed Nintendo DS</h3>
	<p>Threaded Nintendo DS emulation is available but requires you serve the content from an HTTPS endpoint which means you will need to put this application behind a reverse proxy, we highly recommend <a href="https://github.com/linuxserver/docker-swag">SWAG</a> to achieve this. DS game compatibility and functionality is greatly expanded by using this threaded emulator particularly on an Xbox console the games run at full speed.</p>
	<p>To enable this emulator just change <span style="background-color:silver;">"emulator": "libretro-melonds"</span> to <span style="background-color:silver;">"emulator": "libretro-melonds_threaded"</span> in the config file.</p>
        <h3>Full speed Sega Saturn</h3>
        <p>Threaded Saturn is available but requires you serve the content from an HTTPS endpoint which means you will need to put this application behind a reverse proxy, we highly recommend <a href="https://github.com/linuxserver/docker-swag">SWAG</a> to achieve this. The non threaded emulator is essentially useless unless running some 2D games, threaded many titles run full speed especially on Xbox, if you find any game lacking try setting the threads to 8 in the RetorArch options menu.</p>
        <p>To enable this emulator just change <span style="background-color:silver;">"emulator": "libretro-yabause"</span> to <span style="background-color:silver;">"emulator": "libretro-yabause_threaded"</span> in the config file.</p>
        <h2>File Downloading</h2>
        <p>As the network of peers grows, art and default file downloading might not be a 100% perfect. You can always click download multiple times, items that have allready been downloaded will pull from your local IPFS node running in this container while missing items will be retried. Please try to download a couple times before reaching out for support. If you are able to we would appreciate if you can forward port 4001 from this container to the public internet, it decentralizes the distribution of files leading to a more robust CDN for all users.</p>
        <h2>Rom Identification basics</h2>
        <p>The basic steps for scanning in roms is:</p>
        <ol>
          <li>Place the roms in the "roms" directory for your system in your mounted /data/ directory.</li>
          <li>Click on the corresponding scan button above.</li>
          <li>Open the item from the menu on the left.</li>
          <li>If any of your roms are unidentified take the time to link them to the correct rom name.</li>
          <li>Click to download all the art items for your identified roms.(logos, videos, etc)</li>
          <li>Click to add the roms to your config file for that system.</li>
        </ol>
        <p>From there you can hop into the frontend interface (default port 80) to browse and play your collection.</p>
        <p>In general this application is referencing metadata based on commonly used identifying metrics for rom files, mostly these revolve around checksums (specifically sha1) of the rom files themselves. This metadata is compiled from lists on no-intro.org for roms and redump.org for CD based games. Now no system is perfect, but the aim is to have community participation expand these lists with the data from their own rom sets. After scanning in your roms you may notice that many of them are un-identified using this metadata, if you took the time to link them to the correct reference information please consider providing your resulting reference data to Github <a href="https://github.com/linuxserver/emulatorjs">Here</a>.</p>
        <h2>Rom Hacks Support</h2>
        <p>Retroarch supports <a href="https://docs.libretro.com/guides/softpatching/">Softpatching</a>, which will apply a patchfile to the base rom on launch. In order to leverage this feature you will need to prepare a custom zip file ending with the file extension ".patchzip". Lets take a popular hack "Invictus" as an example for snes. You will need to create a zip file named "Invictus.smc.patchzip" (note the two file extensions with smc indicating the extension of the base rom) containing the following files:</p>
        <ul>
          <li>Invictus.smc - base rom file to be patched in this case SMW.</li>
          <li>Invictus.bps - Patch file to be applied.</li>
        </ul>
        <p>Multiple patch files can be applied as long as they follow this naming scheme ending in the order to be loaded IE:</p>
        <ul>
          <li>Invictus.smc - base rom file to be patched in this case SMW.</li>
          <li>Invictus.bps - First patch file to be applied.</li>
          <li>Invictus.bps1 - Second patch file to be applied.</li>
        </ul>
        <p>This patchzip format can also be used for any multifile rom like SNES MSU1 Enhanced games that are supported by Snes9X, for example A Link to the Past MSU1 create a folder containing: (this is just an example some of these files might not be required)</p>
        <ul>
          <li>alttp_msu.sfc - base rom file that has been patched to support enhanced audio.</li>
          <li>manifest.bml - MSU1 manifest with tracklist and memory addresses.</li>
          <li>alttp_msu.xml - XML manifest.</li>
          <li>alttp_msu.msu - Video data.</li>
          <li>alttp_msu-[1-xx].pcm - Audio data files.</li>
        </ul>
        <p>Just like the rom hacks name the zip file the same as the rom name in this example "alttp_msu.sfc.patchzip"</p>
        <h2>Multi Disk Games</h2>
        <p>The only web emulators that supports multiple CD games are psx and saturn, in order to function please rename your chd files before scanning them in to the same name with the extension .disk1,.disk2,.disk3,etc. IE:</p>
        <ul>
          <li>/data/psx/roms/GAMENAME.disk1</li>
          <li>/data/psx/roms/GAMENAME.disk2</li>
          <li>/data/psx/roms/GAMENAME.disk3</li>
        </ul>
	<h2>MAME roms with chds</h2>
	<p>The web based arcade emulator is MAME 2003-Plus, in general most games will work if you use full non-merged roms. Some games require additional chd files though. In order to get these to load with the web frontend we have a custom file format that can be loaded by the extension ".multizip". To create this file simply zip the rom zip and the chd file (no folders) into a single file. IE if you had the file kinst.zip and the folder kinst/kinst.chd simply move the kinst.zip file into the kinst folder and create the archive using <b>zip kinst.multizip kinst.zip kinst.chd</b> then move the resulting file to your roms directory. This multizip file will be unpacked before the emulator is loaded into the directory it is looking for the files.</p>
        <h2>Doom wads with multiple wads</h2>
        <p>The web based emulator is prboom, Zdoom pk3 style mods are not supported. Most community wads out there will also require stock doom2 or doomu wads to function. In order to get these to load with the web frontend we have a custom file format that can be loaded by the extension ".multiwad". To create this file simply zip the multiple wads into a single file. IE if you had the file Valiant.wad needing doom2.wad simply move them into the same directory and run <b>zip Valiant.multiwad Valiant.wad doom2.wad</b> then move the resulting file to your roms directory. This multiwad file will be unpacked before the emulator is loaded and all files made available.</p>
        <h2>Expanding on identification</h2>
        <p>For all CD based system only bin/cue and chd files are supported for identification purposes, you may be able to use iso files, but automatic identification will not be possible. The only system without chd support is 3do, in all other cases you are best off using chd based roms.<p>
        <p>Depending on the type of game you are trying to scan in this process can take some time, particularly for CD based games in CHD format as we need to pull out individual tracks in many cases to sha1sum the resulting data. In general identifying CD based games is very difficult and in some cases these will simply be lists of file names as there is not a reliable way to compare the sums of different tracks from the CDs. We use the following methods to try to create unique metadata strings to look up for each rom. If a rom is zipped or 7zipped it will be extracted and the resulting file checksummed.</p>
        <ul>
          <li>3DO- 3DO cd images only contain a single track so we sha1sum that track, must be iso or bin files. If you have .img files please simply rename to iso or bin.</li>
          <li>Arcade- Arcade roms use name based identifcation and need to be MAME 2003-Plus Full non merged roms. (the roms with all files/parents in single zip file)</li>
          <li>Atari 2600- Sha1summed rom files.</li>
          <li>Atari 7800- Sha1summed rom files.</li>
          <li>Colecovision- Sha1summed rom files.</li>
          <li>Doom- Sha1summed wad files.</li>
          <li>Game Boy Advance- Sha1summed rom files.</li>
          <li>Game Boy Color- Sha1summed rom files.</li>
          <li>Game Boy- Sha1summed rom files.</li>
          <li>Jaguar- Sha1summed rom files, specifically J64 roms only.</li>
          <li>Atari LYNX- Sha1summed rom files.</li>
          <li>MSX- Floppy images are not supported only cartridge based roms, sha1summed rom files.</li>
          <li>Nintendo 64- BigEndian roms only (.z64), sha1summed rom files.</li>
          <li>Nintendo DS- Decrypted roms only, sha1summed rom files.</li>
          <li>Nintendo Entertainment System- We use a helper NES20Tool to pull all headers out of files (.nes) since the standard was set all NES roms should have this header information, sha1summed rom files.</li>
          <li>Neo Geo Pocket (color)- Sha1summed rom files.</li>
          <li>Odyssey2- Sha1summed rom files.</li>
          <li>PC Engine (TurboGrafx-16)- The rom files are sha1summed rom files, while the chd cd images use a name reference system as there is no reliable way to pull a non colliding checksum track out of the CDs.</li>
          <li>Playstation- Currently Playstation is a bit of a mess, optimally we would have identification support for PBP files as they are multi CD out of the box and very popular, but identifying these is impossible via Linux CLI as of now. So for identification we depend on extracting out chd files and checksumming the 1st track.</li>
          <li>Sega 32x- Sha1summed rom files.</li>
          <li>Sega CD- Extract and sum the first track of CHD files.</li>
          <li>Sega Game Gear- Sha1summed rom files.</li>
          <li>Sega Mega Drive- Sha1summed rom files.</li>
          <li>Sega Master System- Sha1summed rom files.</li>
          <li>Sega Saturn- Name based identification, to much track collision for sha1.</li>
          <li>Sega SG-1000- Sha1summed rom files.</li>
          <li>Super Nintendo- Sha1summed rom files.</li>
          <li>Vectrex- Sha1summed rom files.</li>
          <li>Virtual Boy- Sha1summed rom files.</li>
          <li>Wonderswan (color)- Sha1summed rom files.</li>
        </ul>
        <h2>General Emulation</h2>
	<p>For the most part all non CD based systems will work fine on mobile devices and the Xbox web browser. In general CD emulation for full sized non stripped games is not going to function outside of a decent PC setup. Mobile and game console browsers lack the ability to dedicate the 100s of megs of memory needed to store and run a CD based game. Sound crackling is normal in web based emulation, in many cases it will actually improve as the game is played longer. Please keep in mind what this is, these are full emulators re-compiled into javascript do not expect perfection. Emulators used with this project:</p>
        <ul>
          <li>3DO- <a href="https://emulatorjs.org/github/docs/Systems/3DO.html">https://emulatorjs.org/github/docs/Systems/3DO.html</a></li>
	  <li>Arcade- <a href="https://github.com/libretro/mame2003-plus-libretro">https://github.com/libretro/mame2003-plus-libretro</a></li>
	  <li>Atari 2600- <a href="https://github.com/libretro/stella2014-libretro">https://github.com/libretro/stella2014-libretro</a></li>
	  <li>Atari 7800- <a href="https://github.com/libretro/prosystem-libretro">https://github.com/libretro/prosystem-libretro</a></li>
	  <li>Colecovision- <a href="https://github.com/libretro/blueMSX-libretro">https://github.com/libretro/blueMSX-libretro</a></li>
	  <li>Doom- <a href="https://github.com/libretro/libretro-prboom">https://github.com/libretro/libretro-prboom</a></li>
          <li>Game Boy Advance- <a href="https://github.com/libretro/vba-next">https://github.com/libretro/vba-next</a></li>
          <li>Game Boy Color- <a href="https://github.com/libretro/Gearboy">https://github.com/libretro/Gearboy</a></li>
          <li>Game Boy- <a href="https://github.com/libretro/Gearboy">https://github.com/libretro/Gearboy</a></li>
          <li>Jaguar- <a href="https://github.com/libretro/virtualjaguar-libretro">https://github.com/libretro/virtualjaguar-libretro</a></li>
          <li>Atari LYNX- <a href="https://github.com/libretro/libretro-handy">https://github.com/libretro/libretro-handy</a></li>
          <li>MSX- <a href="https://github.com/libretro/blueMSX-libretro">https://github.com/libretro/blueMSX-libretro</a></li>
          <li>Nintendo 64- <a href="https://github.com/libretro/mupen64plus-libretro-nx">https://github.com/libretro/mupen64plus-libretro-nx</a></li>
          <li>Nintendo DS- <a href="https://github.com/libretro/melonDS">https://github.com/libretro/melonDS</a></li>
          <li>Nintendo Entertainment System- <a href="https://github.com/libretro/libretro-fceumm">https://github.com/libretro/libretro-fceumm</a></li>
          <li>Neo Geo Pocket (color)- <a href="https://github.com/libretro/beetle-ngp-libretro">https://github.com/libretro/beetle-ngp-libretro</a></li>
          <li>Odyssey2- <a href="https://github.com/libretro/libretro-o2em">https://github.com/libretro/libretro-o2em</a></li>
          <li>PC Engine (TurboGrafx-16)- <a href="https://github.com/libretro/beetle-pce-fast-libretro">https://github.com/libretro/beetle-pce-fast-libretro</a></li>
          <li>Playstation- <a href="https://github.com/thelamer/retrostash/tree/master/beetle-psx-libretro">https://github.com/thelamer/retrostash/tree/master/beetle-psx-libretro</a></li>
          <li>Sega 32x- 32x currently has no functional emulator I can distribute.</a></li>
          <li>Sega CD- <a href="https://github.com/libretro/Genesis-Plus-GX">https://github.com/libretro/Genesis-Plus-GX</a></li>
          <li>Sega Game Gear- <a href="https://github.com/libretro/Genesis-Plus-GX">https://github.com/libretro/Genesis-Plus-GX</a></li>
          <li>Sega Mega Drive- <a href="https://github.com/libretro/Genesis-Plus-GX">https://github.com/libretro/Genesis-Plus-GX</a></li>
          <li>Sega Master System- <a href="https://github.com/libretro/Genesis-Plus-GX">https://github.com/libretro/Genesis-Plus-GX</a></li>
          <li>Sega Saturn- <a href="https://github.com/libretro/yabause">https://github.com/libretro/yabause</a></li>
          <li>Sega SG-1000- <a href="https://github.com/libretro/Genesis-Plus-GX">https://github.com/libretro/Genesis-Plus-GX</a></li>
          <li>Super Nintendo- <a href="https://github.com/libretro/snes9x">https://github.com/libretro/snes9x</a></li>
          <li>Vectrex- <a href="https://github.com/libretro/libretro-vecx">https://github.com/libretro/libretro-vecx</a></li>
          <li>Virtual Boy- <a href="https://github.com/libretro/beetle-vb-libretro">https://github.com/libretro/beetle-vb-libretro</a></li>
	  <li>Wonderswan (color)- <a href="https://github.com/libretro/beetle-wswan-libretro">https://github.com/libretro/beetle-wswan-libretro</a></li>
        </ul>
      </div>
    </div>
    <div id="landing" class="hidden">
      <div class="centered">
        <h1>Please Download the default fileset to begin:</h1>
	<button class="scanbutton hover" onclick="dlDefaultFiles()">Download</button>
      </div>
    </div>
    <div id="filelanding" class="hidden">
      <div class="centered">
        <h1>Choose a folder. Drag and drop files or right click to upload.</h1>
      </div>
    </div>
    <div id="metainfo" class="hidden">
      <div class="readme">
        <h2>Custom Metadata</h2>
	<p>When you identify roms or upload custom artwork from the rom management interface all of that data is stored as custom metadata in your container. You can see the systems you have put the work into either skinning or identifying on the left. On top of that when you upload custom art assets from this web interface those items are added to the local IPFS server running in this Docker container. To share this data with the world you will need to forward port 4001 to a public IP address.</p>
	<h2>Help us out</h2>
	<p>You went through the process of linking up roms and cleaning up the artwork the way you like it, odds are another person would appreciate not doing the same work you did. If you are able to please share your metadata to <a href="https://github.com/linuxserver/emulatorjs/issues">GitHub</a> or hop on our <a href="https://discord.gg/YWrKVTn">Discord Server</a> and share it there. We can help with file optimization and getting stuff pinned to IPFS permanently. Just copy and paste the metadata to something like <a href="https://pastebin.com/">Paste Bin</a>.</p>
      </div>
    </div>
    <script src="socket.io/socket.io.js"></script>
    <script src="public/js/vendor/jquery.min.js"></script>
    <script src="public/js/vendor/ace.js"></script>
    <script src="public/js/index.js"></script>
  </body>
</html>
